package com.cl.unipay4j.wx;

import com.cl.unipay4j.core.pay.INotify;
import com.cl.unipay4j.core.pay.IPayment;
import com.cl.unipay4j.core.pay.IQuery;
import com.cl.unipay4j.core.pay.IRefund;
import com.cl.unipay4j.core.transfer.ITransfer;

/**
 * 微信支付工程服务类
 *
 * @author siashan
 * @since v1.0.1
 **/
public class WxPayFactoryProvider {
    /**
     * 微信配置文件
     */
    private WxPayProperties wxPayProperties;

    /**
     * 微信工厂类
     */
    private WxPayFactory wxPayFactory;

    public WxPayFactoryProvider(WxPayProperties wxPayProperties, WxPayFactory wxPayFactory) {
        this.wxPayProperties = wxPayProperties;
        this.wxPayFactory = wxPayFactory;
    }

    /**
     * 获取支付对象
     *
     * @param tradeType   交易类型
     * @return 支付类
     */
    public IPayment getPayment(String tradeType) {
        return wxPayFactory.getPayment(tradeType, wxPayProperties.getConfig());
    }


    /**
     * 获取回调对象
     *
     * @return 回调类
     */
    public INotify getNotify() {
        return wxPayFactory.getNotify(wxPayProperties.getConfig());
    }


    /**
     * 获取查询对象
     *
     * @return 查询类
     */
    public IQuery getQuery() {
        return wxPayFactory.getQuery(wxPayProperties.getConfig());
    }


    /**
     * 获取转账对象
     *
     * @return 转账类
     */
    public ITransfer getTransfer() {
        return wxPayFactory.getTransfer(wxPayProperties.getConfig());
    }

    /**
     * 获取退款对象
     *
     * @return 退款类
     */
    public IRefund getRefund() {
        return wxPayFactory.getRefund(wxPayProperties.getConfig());
    }

}
